<?php
	header("Content-Type: text/html;charset=utf-8");
	include("../_judge.php");
	include("../../function/function.php");
	
	$action = chkstr(trim($_REQUEST['action']));
	$webad_title = chkstr(trim($_REQUEST['webad_title']));
	$webad_content = chkstr(trim($_REQUEST['webad_content']));
	$userid = $_POST['userid'];
	
	if(is_array($userid)){ // 拆分数组
		$userid = implode(',',$userid);
	}

	if($action == "add"){
		if(strlen($webad_title)<1 || strlen($webad_content)<1){
			echo erro("请将信息填写完整");
		}
		
		$userid = explode(',',$userid);
		foreach($userid as $v){
			webAD($v,$webad_title,$webad_content);
		}
		echo ok("操作成功","newsadd.php");
	}else{
		echo erro("参数错误");
	}
	
?>
